/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package lomtools.services;

import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Leonardo Oliveira Moreira
 * 
 */
public abstract class GenericFormService extends GenericService {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("text/html;charset=UTF-8");
        System.out.println(">>> GenericFormService Start");
        processRequest(req, resp);
        req.setAttribute("action", "Inserir" + getEntity() + "Servlet");
        System.out.println(">>> GenericFormService End");
        RequestDispatcher dispatcher = req.getRequestDispatcher("/WEB-INF/jsp/" + getEntity().toLowerCase() + "/form.jsp");
        dispatcher.forward(req, resp);
    }

    public abstract String getEntity();

}
